﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;

namespace TransLogger.Module.Win.Editors
{
    interface IPictureSource
    {
        Image RetrieveImage();
    }

    class FilePictureSource : IPictureSource
    {
        private readonly string[] _files;
        private int _index;

        public FilePictureSource(string directory)
        {
            _files = Directory.GetFiles(directory, "*.jpg");
            _index = 0;
        }

        public Image RetrieveImage()
        {
            var img = Image.FromFile(_files[_index]);
            _index = ++_index % _files.Count();
            return img;
        }
    }
}
